package GUI;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

import java.awt.Font;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
/**
 * this is the Main GUI for choosing the option for log in.
 * @author Or Marx
 */
public class FrameSystem extends JFrame{
	private static String loggedIn;
	public static String getLoggedIn()
	{
		return loggedIn;
	}
	public static void setLoggedIn(String login)
	{
		loggedIn=login;
	}
	static JFrame frame;
	public static JFrame getFrame()
	{
		return frame;
	}
	/**
	 * is the constructor. it has the buttons that will transfer us to the correct log in window.
	 */
	public FrameSystem() {
		getContentPane().setLayout(null);
		frame=this;
		JLabel lblWelcomeToHankal = new JLabel("Welcome to hankal!");
		lblWelcomeToHankal.setFont(new Font("Tahoma", Font.PLAIN, 30));
		lblWelcomeToHankal.setBounds(289, 51, 337, 65);
		getContentPane().add(lblWelcomeToHankal);
		
		JButton btnCustomer = new JButton("Customer");
		btnCustomer.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				CustomerLogInGui next=new CustomerLogInGui();
				next.setFrame(frame);
				next.setLastPanel((JPanel) frame.getContentPane());
				frame.setContentPane(next);
				frame.setVisible(true);
			}
		});
		btnCustomer.setBounds(29, 215, 123, 44);
		getContentPane().add(btnCustomer);
		
		JLabel lblChooseYourUser = new JLabel("choose your user type to login:");
		lblChooseYourUser.setFont(new Font("Tahoma", Font.PLAIN, 15));
		lblChooseYourUser.setBounds(302, 146, 232, 23);
		getContentPane().add(lblChooseYourUser);
		
		JButton btnCompanyManager = new JButton("Company Manager");
		btnCompanyManager.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				CompanyManagerLogInGui next=new CompanyManagerLogInGui();
				next.setFrame(frame);
				next.setLastPanel((JPanel) frame.getContentPane());
				frame.setContentPane(next);
				frame.setVisible(true);
			}
		});
		btnCompanyManager.setBounds(187, 215, 138, 44);
		getContentPane().add(btnCompanyManager);
		
		JButton btnParkingLotManager = new JButton("Parking Lot Manager");
		btnParkingLotManager.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				ParkingLotManagerLogInGui next=new ParkingLotManagerLogInGui();
			next.setFrame(frame);
			next.setLastPanel((JPanel) frame.getContentPane());
			frame.setContentPane(next);
			frame.setVisible(true);
			}
		});
		btnParkingLotManager.setBounds(363, 215, 148, 44);
		getContentPane().add(btnParkingLotManager);
		
		JButton btnParkingLotWorker = new JButton("Parking Lot Worker");
		btnParkingLotWorker.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				ParkingLotWorkerLogInGui next=new ParkingLotWorkerLogInGui();
				next.setFrame(frame);
				next.setLastPanel((JPanel) frame.getContentPane());
				frame.setContentPane(next);
				frame.setVisible(true);
			}
		});
		btnParkingLotWorker.setBounds(558, 215, 123, 44);
		getContentPane().add(btnParkingLotWorker);
		
		JButton btnServiceClassWorker = new JButton("Service Class worker");
		btnServiceClassWorker.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				ServiceClassWorkerLogInGui next=new ServiceClassWorkerLogInGui();
			next.setFrame(frame);
			next.setLastPanel((JPanel) frame.getContentPane());
			frame.setContentPane(next);
			frame.setVisible(true);
			}
		});
		btnServiceClassWorker.setBounds(728, 215, 160, 44);
		getContentPane().add(btnServiceClassWorker);
		
	}

}
